Published: May 26, 2025
Use texture view for externalTexture binding
A compatible GPUTextureView (2D, single subresource) is now allowed to be used in place of a GPUExternalTexture binding when creating a GPUBindGroup.
This simplifies shader logic in video effects pipelines where both GPUExternalTexture (for source video) and GPUTextureView (for intermediate processing) have to be handled. It also reduces the need to dynamically compile shaders depending on where the texture comes from. See Intent to Ship: WebGPU: GPUTextureView for externalTexture binding.
const texture = myDevice.createTexture({
size: [42, 42],
format: navigator.gpu.getPreferredCanvasFormat(),
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING,
});
const code = `
@group(0) @binding(0) var texture : texture_external;
@group(0) @binding(1) var<storage, read_write> buffer: vec2u;
@compute @workgroup_size(1) fn main() {
buffer = textureDimensions(texture);
}`;
const pipeline = myDevice.createComputePipeline({
layout: "auto",
compute: { module: myDevice.createShaderModule({ code }) },
});
const bindGroup = myDevice.createBindGroup({
layout: pipeline.getBindGroupLayout(0),
entries: [
{ binding: 0, resource: texture.createView() }, // Use texture view for an externalTexture binding
{ binding: 1, resource: { buffer: myBuffer } },
],
});
Buffers copy without specifying offsets and size
A new GPUCommandEncoder method overload lets developers omit offsets and size parameters when using copyBufferToBuffer()
to simplify the copy of entire buffers. See Intent to Ship: WebGPU: copyBufferToBuffer overload.
const size = 42;
const srcBuffer = myDevice.createBuffer({
size,
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC,
});
const dstBuffer = myDevice.createBuffer({
size,
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ,
});
// Copy entire buffer.
myCommandEncoder.copyBufferToBuffer(srcBuffer, dstBuffer);
// This is the same as the following.
// myCommandEncoder.copyBufferToBuffer(srcBuffer, 0, dstBuffer, 0, size);
WGSL workgroupUniformLoad using pointer to atomic
A new workgroupUniformLoad(ptr)
overload in WGSL has been added for developer convenience. It atomically loads the value pointed to by ptr
and returns it to all invocations in the workgroup, where ptr
is a pointer-to-atomic inside a workgroup variable. See issue 408241039.
@group(0) @binding(0) var<storage, read_write> buffer : array<u32, 1>;
var<workgroup> wgvar : atomic<u32>;
@compute @workgroup_size(1, 1)
fn main(@builtin(local_invocation_index) lid: u32) {
if (lid == 0) {
atomicStore(&(wgvar), 42u);
}
buffer[lid] = workgroupUniformLoad(&wgvar);
}
GPUAdapterInfo powerPreference attribute
The non-standard powerPreference
GPUAdapterInfo string attribute is now available when the user has enabled the "WebGPU Developer Features" flag at chrome://flags/#enable-webgpu-developer-features
. If supported, the powerPreference
value can be either "low-power"
or "high-performance"
depending on the GPUPowerPreference value that was used in GPURequestAdapterOptions. See CL 6438860.
function checkPowerPreferenceForGpuDevice(device) {
const powerPreference = device.adapterInfo.powerPreference;
if (powerPreference === "high-performance") {
// High-performance GPU detected. Enabling enhanced graphics settings.
} else if (powerPreference === "low-power") {
// Low-power GPU detected. Optimizing for battery life.
}
}
Remove GPURequestAdapterOptions compatibilityMode attribute
The experimental GPURequestAdapterOptions compatibilityMode
attribute has been removed in favor of the standardized featureLevel
attribute added in Chrome 133. See issue 366151404.
Dawn updates
Developers can build WebGPU projects in languages like C++, using webgpu.h to target both WebAssembly and specific platforms. Dawn's newly-released "emdawnwebgpu" ("Emscripten Dawn WebGPU") implements the latest standardized webgpu.h over the browser API.
Emdawnwebgpu is a (maintained) fork of Emscripten's (now unmaintained) built-in bindings (USE_WEBGPU
). All new development is being done on emdawnwebgpu, and Emscripten's built-in bindings will be removed as developers transition to emdawnwebgpu. Emdawnwebgpu's C header is very close to Dawn's, whereas the built-in bindings are significantly outdated.
Download emdawnwebgpu from Dawn's GitHub releases page and read the package's README.md for information on how to use it. The source files can be found in the Dawn repository.
For a complete guide, check out the updated Build an app with WebGPU documentation.
This covers only some of the key highlights. Check out the exhaustive list of commits.
What's New in WebGPU
A list of everything that has been covered in the What's New in WebGPU series.
Chrome 137
- Use texture view for externalTexture binding
- Buffers copy without specifying offsets and size
- WGSL workgroupUniformLoad using pointer to atomic
- GPUAdapterInfo powerPreference attribute
- Remove GPURequestAdapterOptions compatibilityMode attribute
- Dawn updates
Chrome 136
- GPUAdapterInfo isFallbackAdapter attribute
- Shader compilation time improvements on D3D12
- Save and copy canvas images
- Lift compatibility mode restrictions
- Dawn updates
Chrome 135
- Allow creating pipeline layout with null bind group layout
- Allow viewports to extend past the render targets bounds
- Easier access to the experimental compatibility mode on Android
- Remove maxInterStageShaderComponents limit
- Dawn updates
Chrome 134
- Improve machine-learning workloads with subgroups
- Remove float filterable texture types support as blendable
- Dawn updates
Chrome 133
- Additional unorm8x4-bgra and 1-component vertex formats
- Allow unknown limits to be requested with undefined value
- WGSL alignment rules changes
- WGSL performance gains with discard
- Use VideoFrame displaySize for external textures
- Handle images with non-default orientations using copyExternalImageToTexture
- Improving developer experience
- Enable compatibility mode with featureLevel
- Experimental subgroup features cleanup
- Deprecate maxInterStageShaderComponents limit
- Dawn updates
Chrome 132
- Texture view usage
- 32-bit float textures blending
- GPUDevice adapterInfo attribute
- Configuring canvas context with invalid format throw JavaScript error
- Filtering sampler restrictions on textures
- Extended subgroups experimentation
- Improving developer experience
- Experimental support for 16-bit normalized texture formats
- Dawn updates
Chrome 131
- Clip distances in WGSL
- GPUCanvasContext getConfiguration()
- Point and line primitives must not have depth bias
- Inclusive scan built-in functions for subgroups
- Experimental support for multi-draw indirect
- Shader module compilation option strict math
- Remove GPUAdapter requestAdapterInfo()
- Dawn updates
Chrome 130
- Dual source blending
- Shader compilation time improvements on Metal
- Deprecation of GPUAdapter requestAdapterInfo()
- Dawn updates
Chrome 129
Chrome 128
- Experimenting with subgroups
- Deprecate setting depth bias for lines and points
- Hide uncaptured error DevTools warning if preventDefault
- WGSL interpolate sampling first and either
- Dawn updates
Chrome 127
- Experimental support for OpenGL ES on Android
- GPUAdapter info attribute
- WebAssembly interop improvements
- Improved command encoder errors
- Dawn updates
Chrome 126
- Increase maxTextureArrayLayers limit
- Buffer upload optimization for Vulkan backend
- Shader compilation time improvements
- Submitted command buffers must be unique
- Dawn updates
Chrome 125
Chrome 124
- Read-only and read-write storage textures
- Service workers and shared workers support
- New adapter information attributes
- Bug fixes
- Dawn updates
Chrome 123
- DP4a built-in functions support in WGSL
- Unrestricted pointer parameters in WGSL
- Syntax sugar for dereferencing composites in WGSL
- Separate read-only state for stencil and depth aspects
- Dawn updates
Chrome 122
- Expand reach with compatibility mode (feature in development)
- Increase maxVertexAttributes limit
- Dawn updates
Chrome 121
- Support WebGPU on Android
- Use DXC instead of FXC for shader compilation on Windows
- Timestamp queries in compute and render passes
- Default entry points to shader modules
- Support display-p3 as GPUExternalTexture color space
- Memory heaps info
- Dawn updates
Chrome 120
- Support for 16-bit floating-point values in WGSL
- Push the limits
- Changes to depth-stencil state
- Adapter information updates
- Timestamp queries quantization
- Spring-cleaning features
Chrome 119
- Filterable 32-bit float textures
- unorm10-10-10-2 vertex format
- rgb10a2uint texture format
- Dawn updates
Chrome 118
- HTMLImageElement and ImageData support in
copyExternalImageToTexture()
- Experimental support for read-write and read-only storage texture
- Dawn updates
Chrome 117
- Unset vertex buffer
- Unset bind group
- Silence errors from async pipeline creation when device is lost
- SPIR-V shader module creation updates
- Improving developer experience
- Caching pipelines with automatically generated layout
- Dawn updates
Chrome 116
- WebCodecs integration
- Lost device returned by GPUAdapter
requestDevice()
- Keep video playback smooth if
importExternalTexture()
is called - Spec conformance
- Improving developer experience
- Dawn updates
Chrome 115
- Supported WGSL language extensions
- Experimental support for Direct3D 11
- Get discrete GPU by default on AC power
- Improving developer experience
- Dawn updates
Chrome 114
- Optimize JavaScript
- getCurrentTexture() on unconfigured canvas throws InvalidStateError
- WGSL updates
- Dawn updates